<?php
header("Content-type: text/html; charset=utf-8"); 
$DBconnect=@mysql_connect('localhost','root','')
  Or die('数据库无法连接');
@mysql_select_db('neu-video',$DBconnect)
  Or die('数据库不存在!');
//mysql_set_charset('utf-8');
$sql ='select * from users';
$result = mysql_query($sql,$conn);
$users = fetch_array($result);
//var_dump($users);
echo '<table border="1">';
echo '<tr><th>用户名</th></tr>性别</th><th>爱好</th><tr>';
foreach ($users as $one ) {
	echo '<tr>';
	echo '<td>'.$one['uname'].'</td>';
	echo '<td>'.$one['sex'].'<sex>.</td>';
	echo '<td>'.$one['hobby'].'</td>';
	echo '</tr>';
}
echo '<table>';
function fetch_array($results){
	$arrs = array();
	while($Result && ($row = mysql_fetch_assoc($results))!==FALSE){
		$arrs[]=$row;
}
return $arrs;
}

/*while($Result && ($row = mysql_fetch_assoc($results))!==FALSE){
echo $row['uname'].'<br>';

}*/
?>
